package com.wf.ew.system.controller;

import com.wf.ew.common.BaseController;
import com.wf.ew.common.JsonResult;
import com.wf.ew.common.PageResult;
import com.wf.ew.system.model.Dictionarydata;
import com.wf.ew.system.service.DictionarydataService;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *
 * controller
 * @author : Doman
 * @date : 2019-08-06 16:09:47
 * @version ：1.0
 */

@Controller
@RequestMapping("/system/dictionarydata")
public class DictionarydataController extends BaseController {

	@Autowired
	private DictionarydataService dictionarydataService;
	
	/**
	 * 页面
	 **/
	@RequestMapping()
	public String dictionarydata(Model model, Dictionarydata dictionarydata) {
		model.addAttribute("dict_code",dictionarydata.getDict_code());
		return "system/dictionarydata.html";
	}

	/**
	 * 查询列表
	 */
	@RequestMapping(value = "/list", produces = {"text/html;charset=UTF-8;"})
	@ResponseBody
	public String list(PageResult<T> page, Dictionarydata dictionarydata){
		return dictionarydataService.list(page, dictionarydata);
	}

	/**
	 * 新增
	 **/
	@ResponseBody
	@RequestMapping("/add")
	public JsonResult add(Model model, Dictionarydata dictionarydata) {
		return dictionarydataService.add(dictionarydata, getLoginUser());
	}

	/**
	 * 修改
	 **/
	@ResponseBody
	@RequestMapping("/update")
	public JsonResult update(Model model, Dictionarydata dictionarydata) {
		return dictionarydataService.update(dictionarydata, getLoginUser());
	}

	/**
	 * 批量删除
	 **/
	@RequestMapping("/delete")
	@ResponseBody
	public JsonResult delete(Dictionarydata dictionarydata ) {
		return dictionarydataService.delete(dictionarydata, getLoginUser());
	}

	/**
	 * 批量删除
	 **/
	@RequestMapping("/dictdata_code_unique")
	@ResponseBody
	public JsonResult dictdata_code_unique(Dictionarydata dictionarydata ) {
		return dictionarydataService.dictdata_code_unique(dictionarydata);
	}
}
